import { BasicColumn, FormSchema } from "/@/components/Table"
import { render } from "/@/utils/common/renderUtils"
import { DescItem } from "/@/components/Description/index"
import { useI18n } from "/@/hooks/web/useI18n"
import { UploadBizType } from "/@/enums/uploadEnum"
import { readonly } from "vue"

const { t } = useI18n("")

export const columns: BasicColumn[] = [
  {
    title: t("模板名称"),
    dataIndex: "name",
    align: "center",
    slot: "preview",
    width: 300,
  },
  {
    title: t("创建时间"),
    dataIndex: "updatedAt",
    width: 150,
    align: "center",
  },
  {
    title: t("创建者"),
    dataIndex: "createdBy",
    width: 100,
  },
]

export const searchFormSchema: FormSchema[] = [
  {
    field: "name",
    label: "模板名称",
    component: "Input",
    componentProps: {
      placeholder: "请输入",
    },
  },
]

export const inputFormSchemas: FormSchema[] = [
  {
    label: "",
    field: "id",
    component: "Input",
    show: false,
  },
  {
    label: t("模板名称"),
    required: true,
    field: "name",
    component: "Input",
    componentProps: {
      maxlength: 300,
    },
  },
  {
    label: t("创建时间"),
    ifShow: ({ values }) => values.id,
    field: "createdAt",
    component: "Input",
    render: ({ model, field }) => {
      return render.renderSpan(model[field])
    },
  },
  {
    label: t("创建者"),
    ifShow: ({ values }) => values.id,
    field: "createdBy",
    component: "Input",
    render: ({ model, field }) => {
      return render.renderSpan(model[field])
    },
  },
  {
    label: t("渲染模板"),
    field: "styleCode",
    component: "RadioGroup",
    required: true,
    defaultValue: "A",
  },
  {
    label: t("显示ID"),
    field: "showIdFlag",
    component: "RadioGroup",
    required: true,
    defaultValue: true,
  },
  {
    label: t("显示门店名称"),
    field: "showStoreNameFlag",
    component: "RadioGroup",
    helpMessage: "码牌创建后若未绑定到商户则不会显示名称，绑定商户后则可正常显示。",
    required: true,
    defaultValue: true,
  },
  {
    label: t("支付渠道"),
    field: "payChannel",
    component: "Input",
    required: false,
    slot: "payChannel",
  },
  {
    label: t("背景颜色"),
    field: "bgColor",
    defaultValue: "#FC7851",
    component: "Input",
    required: false,
    slot: "bgColor",
  },
  {
    label: t("自定义背景颜色"),
    field: "customBgColor",
    defaultValue: "#000000",
    component: "Input",
    required: false,
    show: false,
  },
  {
    label: t("主体Logo"),
    field: "logoImgUrl",
    component: "MyImageUpload",
    helpMessage: "显示在顶部， 透明图片， 建议尺寸： 924 X 282",
    required: false,
  },
  {
    label: t("二维码上的logo"),
    field: "qrInnerImgUrl",
    component: "MyImageUpload",
    helpMessage: "建议尺寸： 80 X 80",
    required: false,
  },
]
